<?php
/**
 * Formulaire de modification du person
 *
 * @author Samir
 */
class Form_Person_UpdateWaiting extends ZendX_JQuery_Form {
	
	private $table_Persons;
	//public $userId = 1;
	public function __construct($options = null){
		parent::__construct($options);
	}
	
	public function init(){

		require_once APPLICATION_PATH . '/decorators/formElementDecorator.php';
		$decorators = new Decorator_FormElement();
		
		$this->setName('form_inscription');

        $civilite = new Zend_Form_Element_Select('civility' );
		$civilite->setLabel('Civilité : ')
           		 ->addMultiOptions(array(null => "Choisir...", "Mr" => "Monsieur",  "Mme" => "Madame", "Mlle" => "Mademoiselle" ))
            	->setRequired(true)
            	->setAttrib('class', 'validate[required]')
            	->addDecorator($decorators);
        $this->addElement($civilite);
		
        $nom = new Zend_Form_Element_Text('firstname');
		$nom->setRequired(true)
	         ->addFilter('StripTags')
	         ->addFilter('StringTrim')
	         ->setAttrib('class', 'validate[required] text-input')
	         ->setLabel(('Nom : '))
	         ->addDecorator($decorators);
	         
		$this->addElement($nom);	
		
		
		$prenom = new Zend_Form_Element_Text('lastname');
		$prenom->setRequired(true)
	         ->addFilter('StripTags')
	         ->addFilter('StringTrim')
	         ->setAttrib('class', 'validate[required] text-input')
	         ->setLabel(('Prénom : '))
	         ->addDecorator($decorators);
		$this->addElement($prenom);	

        $function = new Zend_Form_Element_Select('function');
		$function-> addDecorator($decorators);
		$function->setLabel('Fonction : ')
				 ->setAttrib('class', 'validate[required]')
				 ->addMultiOption("" , "Choisir ...")
				 ->addMultiOption('president', 'Président')
				 ->addMultiOption('vice-president' ,'Vice-Président')
				 ->addMultiOption('tresorier' , 'Trésorie')
				 ->addMultiOption('vice-tresorier' , 'Vice-Trésorie')
				 ->addMultiOption('secretaire' , 'Secrétaire')
				 ->addMultiOption('vice-secretaire' , 'Vice-Secrétaire')
				 ->addMultiOption( 'administrator', 'Administrator')
				 ->addMultiOption('charger-de-mission' ,'Chargé de Mission') 
				 ->addMultiOption('animateur_bdi' ,'Animateur BDI')
				 ->addMultiOption('permanent', 'Permanent')
				 ->addMultiOption('formateur-relais', 'Formateur Relais');
        $this->addElement($function);
       	
        $email = new Zend_Form_Element_Text('email');
		$email->setRequired(true)
	         ->addFilter('StripTags')
	         ->addFilter('StringTrim')
	         ->setAttrib('class', 'validate[required,custom[email]] text-input')
	         ->setLabel(('Adresse mail 1 : '))
			 ->addDecorator($decorators);
		$this->addElement($email);	
		
        $email2 = new Zend_Form_Element_Text('email2');
		$email2->addFilter('StripTags')
	         ->addFilter('StringTrim')
	         ->setAttrib('class', '')
	         ->setLabel(('Adresse mail 2 : '))
			 ->addDecorator($decorators);
		$this->addElement($email2);	
		
		$address = new Zend_Form_Element_Textarea('address');
		$address->addFilter('StripTags')
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'validate[required] text-input')
		         ->setLabel(('Adresse postale : '))
		         ->setAttrib('rows',3) 
		         ->setAttrib('cols',23)
		         ->setRequired(true)
			 	 ->addDecorator($decorators);
	 	$this->addElement($address);
	 		
		$zipcode = new Zend_Form_Element_Text('zipcode');
		$zipcode->addFilter('StripTags')
				 ->setRequired(true)
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'validate[required,custom[onlyNumber],length[5]] text-input')
		         ->setLabel(('Code Postal : '))
				 ->addDecorator($decorators);
		$this->addElement($zipcode);
					
        $city = new Zend_Form_Element_Text('city');
		$city->setRequired(true)
	         ->addFilter('StripTags')
	         ->addFilter('StringTrim')
	         ->setAttrib('class', 'validate[required] text-input')
	         ->setLabel('Ville : ')
	         ->addDecorator($decorators);
	         
		$this->addElement($city);	
		
		
		$echelonList = new Zend_Form_Element_Multiselect('echelonlist');
	 	$echelonList->setRegisterInArrayValidator(false);
		$this->addElement($echelonList);
		 
		$phone = new Zend_Form_Element_Text('telephone');
		$phone->addFilter('StripTags')
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'validate[custom[telephone]] text-input')
		         ->setLabel(('Télephone : '))
		         ->addDecorator($decorators);
				 $this->addElement($phone);	
		
		$mobilephone = new Zend_Form_Element_Text('mobilephone');
		$mobilephone->addFilter('StripTags')
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'text-input')
		         ->setLabel(('Télephone portable : '))
		         ->addDecorator($decorators);
				 $this->addElement($mobilephone);	
				 
		$fax = new Zend_Form_Element_Text('fax');
		$fax->addFilter('StripTags')
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'validate[custom[telephone]] text-input')
		         ->setLabel(('Fax : '))
		         ->addDecorator($decorators);
				 $this->addElement($fax);	
				 
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Mot de passe : ')
        		 ->setValue(null)
        		 ->setAttrib('class', 'text-input')
        		 ->addFilter('StripTags')
        		 ->addFilter('StringTrim')
        		 ->addDecorator($decorators);
        $this->addElement($password);      

        $password_bis = new Zend_Form_Element_Password('password_confirmation');
        $password_bis->setLabel('Confirmation du mot de passe : ')
		        ->addFilter('StripTags')
		        ->addFilter('StringTrim')
		        ->setValue(null)
		        ->setAttrib('class', 'validate[confirm[password]] text-input')
		        ->addDecorator($decorators);
        $this->addElement($password_bis);

        $echelon_etab = new Zend_Form_Element_Radio('echelon_etab',array('label_style' => 'float: left;')); 
		$echelon_etab->setLabel('Echelon dont vous dependez (le plus haut) : ');
		$echelon_etab -> addMultiOption('4','Apel d\'etablissement')
				  ->setDecorators(array(
		         			'viewHelper',
					         'description',
					         'errors',
					         array('htmlTag', array('tag'=>"div")),
					         array('label', array('tag'=>"div"))))
				  ->setOptions(array('label_style' => 'float: left; margin-left: 185px; margin-top: 17px;', 
				 					'style' =>'float: left;', 'class'=>'parent_choice', 'id' =>'radio'));    		 
	    $this->addElement($echelon_etab);    
	    
      	$echelon_depa = new Zend_Form_Element_Radio('echelon_depa',array('label_style' => 'float: left;')); 
		$echelon_depa->setLabel('');
		$echelon_depa -> addMultiOption('3','Apel departementale')
				  ->setDecorators(array(
		         			'viewHelper',
					         'description',
					         'errors',
					         array('htmlTag', array('tag'=>"div")),
					         array('label', array('tag'=>"div"))))
				  ->setOptions(array('label_style' => 'float: left; margin-left: 185px;', 
				 					'style' =>'float: left;', 'class'=>'parent_choice', 'id' =>'radio'));    		 
	    $this->addElement($echelon_depa);    
	    
      	$echelon_acad = new Zend_Form_Element_Radio('echelon_acad',array('label_style' => 'float: left;')); 
		$echelon_acad->setLabel('');
		$echelon_acad -> addMultiOption('2','Apel academique')
				  ->setDecorators(array(
		         			'viewHelper',
					         'description',
					         'errors',
					         array('htmlTag', array('tag'=>"div")),
					         array('label', array('tag'=>"div"))))
				  ->setOptions(array('label_style' => 'float: left; margin-left: 185px; ', 
				 					'style' =>'float: left;', 'class'=>'parent_choice', 'id' =>'radio'));    		 
	    $this->addElement($echelon_acad);    
	    
      	$echelon_nati = new Zend_Form_Element_Radio('echelon_nati',array('label_style' => 'float: left;')); 
		$echelon_nati->setLabel('');
		$echelon_nati -> addMultiOption('1','Apel nationale')
				  ->setDecorators(array(
		         			'viewHelper',
					         'description',
					         'errors',
					         array('htmlTag', array('tag'=>"div")),
					         array('label', array('tag'=>"div"))))
				  ->setOptions(array('label_style' => 'float: left; margin-left: 185px;', 
				 					'style' =>'float: left;', 'class'=>'parent_choice', 'id' =>'radio'));    		 
	    $this->addElement($echelon_nati);  
	      
	    $choix_echelon_depa = new Zend_Form_Element_Select('choix_echelon_depa');
		$choix_echelon_depa-> addDecorator($decorators)
						   ->addMultiOption("" , "Departement ...")
		        		   ->setOptions(array('nextLevel'=>"city", 'id' =>'4_department_list', 'disabled'=>'disabled' ));
        $choix_echelon_depa->setRegisterInArrayValidator(false);
		$this->addElement($choix_echelon_depa);   
			 
        $choix_echelon_city = new Zend_Form_Element_Select('choix_echelon_city');
		$choix_echelon_city-> addDecorator($decorators)
						   ->addMultiOption("" , "Ville ...")
						   ->setOptions(array('nextLevel'=>"etb", 'id' =>'4_city_list', 'disabled'=>'disabled' ));
        $choix_echelon_city->setRegisterInArrayValidator(false);
        $this->addElement($choix_echelon_city);   
         
	    $choix_echelon_etab = new Zend_Form_Element_Select('choix_echelon_etab');
		$choix_echelon_etab->addDecorator($decorators)
						   ->addMultiOption("" , "Etablissement ...")
						   ->setOptions(array('nextLevel'=>"", "final" =>'true', 'id' =>'4_etb_list', 'disabled'=>'disabled' ));
        $choix_echelon_etab->setRegisterInArrayValidator(false);
        $this->addElement($choix_echelon_etab);   
         
        $departement_list = new Zend_Form_Element_Select('departement_list');
		$departement_list-> addDecorator($decorators) 
						 ->addMultiOption("" , "Departement ...")
						 ->setOptions(array('disabled'=>'disabled' ));
        $this->addElement($departement_list);   
         
	        		 
        $academique_list = new Zend_Form_Element_Select('academique_list');
		$academique_list-> addDecorator($decorators) 
						->addMultiOption("" , "Academie ...")
						->setOptions(array('disabled'=>'disabled' ));
		$academique_list->setRegisterInArrayValidator(false);
        $this->addElement($academique_list);   
        
        $email_show = new Zend_Form_Element_Checkbox('email_show');
		$email_show->addFilter('StripTags')
	        	 	 ->addFilter('StringTrim')
	        		 ->setLabel(("J'accepte que ces informations figurent dans l'annuaire de l'intranet "))
	        		 ->setDecorators(
									Array(
										'ViewHelper',
										array('Label', array('class' => 'label_checkbox'))
									)
								);
	    $this->addElement($email_show);
        
        $email_show2 = new Zend_Form_Element_Checkbox('email_show2');
		$email_show2->addFilter('StripTags')
	        	 	 ->addFilter('StringTrim')
	        		 ->setLabel(("J'accepte que ces informations figurent dans l'annuaire de l'intranet : "))
	        		 ->setDecorators(
									Array(
										'ViewHelper',
										array('Label', array('class' => 'label_checkbox'))
									)
								);
	    $this->addElement($email_show2);
	
        $basic_informations_person_show	= new Zend_Form_Element_Checkbox('basic_informations_person_show');
		$basic_informations_person_show->addFilter('StripTags')
	        	 	 ->addFilter('StringTrim')
	        		 ->setLabel(("J'accepte que ces informations figurent dans l'annuaire de l'intranet : "))
	        		 ->setDecorators(
									Array(
										'ViewHelper',
										array('Label', array('class' => 'label_checkbox'))
									)
								);
	    $this->addElement($basic_informations_person_show);
        
        $mobilephone_show = new Zend_Form_Element_Checkbox('mobilephone_show');
		$mobilephone_show->addFilter('StripTags')
	        	 	 ->addFilter('StringTrim')
	        		 ->setLabel(("J'accepte que mon Télephone portable figure dans l'annuaire de l'intranet : "))
	        		 ->setDecorators(
									Array(
										'ViewHelper',
										array('Label', array('class' => 'label_checkbox'))
									)
								);	        		
	    $this->addElement($mobilephone_show);

	    $url = new Zend_Form_Element_Text('url');
		$url->addFilter('StripTags')
		         ->addFilter('StringTrim')
		         ->setAttrib('class', 'text-input')
		         ->setLabel("Adresse du site de l'Apel de votre établissement : ")
				 ->addDecorator($decorators);
		$this->addElement($url);

		
		
		$network = new Zend_Form_Element_MultiCheckbox('network');
		$network->addMultiOptions(
			array(
				'none' => "none",
				'icf' => 'icf',
				'ecole et monde professionnel' => 'ecole et monde professionnel',
				'securite aux abords des etablissements' => 'securite aux abords des etablissements',
				'rap' => 'rap',
			)
		);
		$network->setRegisterInArrayValidator(false);
		$this->addElement($network);

        
	    
	    
	    
	    
        $this->addElement(
                'submit',
                'submit',
                array(
                    'decorators' => array(
                        'ViewHelper',
                        'Errors',
                        array('Description', array('tag' => 'p', 'class' => 'description')),
                        array('HtmlTag', array('tag' => 'span', 'class' => "aligne-centre ")),
                        array(array('div' => 'HtmlTag'),
                            array('tag' => 'p', 'class' => "form-table"))
                    ),
                    'label' => 'Valider',
                    'class'=>'submit'
        ))->clearDecorators();
    }
}
